package com.online.websocketcluster.service;

import com.online.websocketcluster.service.impl.SessionManageServiceImpl;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.Map;

/**
 *   会话，redis缓存接口服务
 *   @author hsc
 *   @create 2018-04-24 10:35
 */
@FeignClient(name="session-manage-cluster",fallback= SessionManageServiceImpl.class)
public interface SessionManageService {

    /**
     * 获取坐席websocket服务地址
     * @param map (service_id 坐席ID)
     * @return
     */
    @PostMapping(value="/getWsAddress")
    Map getWsAddress(@RequestBody Map map);

    /**
     * 校验token接口
     * @param map (service_id 坐席ID, token)
     * @return
     */
    @PostMapping(value="/checkToken")
    Map checkToken(@RequestBody Map map);

    /**
     * 消息同步接口
     * @param map (service_id 坐席ID, session_id会话ID)
     * @return messages 消息集合
     */
    @PostMapping(value="/getMessages")
    Map getMessages(@RequestBody Map map);

    /**
     * 删除websocket服务地址
     * @param map (service_id 坐席ID)
     * @return
     */
    @PostMapping(value="/delWsAddress")
    Map delWsAddress(@RequestBody Map map);

    /**
     * 保存坐席websocket服务地址
     * @param map (service_id 坐席ID ,address服务地址)
     * @return
     */
    @PostMapping(value="/saveWsAddress")
    Map saveWsAddress(@RequestBody Map map);

    /**
     * 查询坐席当前所有会话
     * @param map (service_id 坐席ID ,e_id 企业ID)
     * @return session_obj 会话对象 ,results当前会话数量
     */
    @PostMapping(value="/getSessionList")
    Map getSessionList(@RequestBody Map map);

    /**
     * 查询微信用户信息
     * @param map
     * @return
     */
    @PostMapping(value = "/getWeChatUser")
    Map getWeChatUser(@RequestBody Map map);
}
